﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace GiMess
{
    public partial class TextInputForm : Form
    {
        private string result = "";
        private bool gotResult = false;

        public TextInputForm()
        {
            InitializeComponent();
            Exists = true;
        }

        public TextInputForm(bool rename)
        {
            InitializeComponent();
            Exists = true;
            if (rename)
                this.Text = "Rename group";
            else
                this.Text = "Type a message to send to the group";
        }

        private void okButton_Click(object sender, EventArgs e)
        {
            result = groupBox.Text;
            gotResult = true;
        }

        private void cancelButton_Click(object sender, EventArgs e)
        {
            gotResult = true;
        }

        public string GetResult()
        {
            while (!gotResult)
                Application.DoEvents();
            Exists = false;
            return result;
        }      

        public static bool Exists { get; set; }
    }
}
